package cn.good.yan.controller;

import cn.good.yan.resp.ResultData;
import cn.good.yan.serivce.AxxService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 演示：分布式事务  - axx
 *
 * @author shengren.yan
 * @create 2022-04-06
 */
@RestController
public class AxxController {

    @Resource
    AxxService axxService;

    /**
     * 扣减账户余额
     */
    @RequestMapping("/axx/decrease")
    public ResultData decrease(@RequestParam("userId") Long userId, @RequestParam("money") Long money) {
        axxService.decrease(userId, money);
        return ResultData.success("扣减账户余额成功！");
    }
}
